<%@page import="cn.sendto.service.CarInfoService"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" errorPage="../err.jsp"%>
    <jsp:include page="../lock.jsp"></jsp:include>
<%
	request.setCharacterEncoding("UTF-8");
	String carnum = request.getParameter("carnum");
	String cartype = request.getParameter("cartype");
	String color = request.getParameter("color");
	String drivenum = request.getParameter("drivenum");
	
	ArrayList<Integer> errlist = new ArrayList<Integer>();
	if(cartype == null || cartype.equals("")){
		errlist.add(1);
	}
	if(color == null || color.equals("")){
		errlist.add(2);
	}
	if(drivenum == null || drivenum.equals("")){
		errlist.add(3);
	}
	
	if(errlist.size() > 0){
		request.setAttribute("errinfo", errlist);
		request.getRequestDispatcher("modcar.jsp").forward(request, response);
		return;
	}
	
	CarInfoService cis = new CarInfoService();
	int i = cis.modCar(cartype,color,drivenum,carnum);
	if(i > 0 ){
		request.setAttribute("carinfo", "修改成功");
		request.getRequestDispatcher("carlist.jsp").forward(request, response);
		return;
	}else{
		request.setAttribute("carinfo", "修改失败");
		request.getRequestDispatcher("carlist.jsp").forward(request, response);
		return;
	}


%>